#pragma once

#include "interfaces.h"
#include <list>
#include <map>
#include <assert.h>
#include <iostream>
#include "Events.h"
typedef std::list< EventListenerPtr > EventListenerList; // list of event lsiteners
typedef std::map < EventType, EventListenerList > EventListenerMap; // event type and subscribed listeners
typedef std::list< EventType > EventTypeList;
#define REE() EventManager::Get()
class EventManager : public IEventManager
{
public:
	explicit EventManager();
	virtual ~EventManager();

	std::list< EventDataPtr > m_EventQueueList[2];
	bool m_ActiveQueue;



	virtual void VTriggerEvent(EventDataPtr eventData);
	virtual void VQueEvent(EventDataPtr eventData);
	virtual void VRemoveLastEventFromQueue();
	virtual void VTick();



	void RegisterGeneralPurposeEvents();

	virtual bool VValidateEventType(const EventType & evt);


	virtual void VAddListener(EventListenerPtr listener, EventType evt_type);
	virtual void VAddListener(EventListenerPtr listener);
	virtual void VRemoveListener(EventListenerPtr listener, EventType evt_type);
	virtual void VRemoveListener(EventListenerPtr listener);


	virtual bool VRegisterEventType(EventType evt_type);


	static EventManager * const Get(); // I'm not really sure how to impl this with const // Nevermind
	static void Release();
public:
	EventListenerMap m_EventListenerMap;
	EventListenerList m_GlobalListeners;
	EventTypeList	m_EventTypeList;
};

